<?php
/**
 * --------------------------------------------------------------
 * crond已授权入口控制器
 * Author: zd <kfzphp@126.com>
 * Date: 2018-06-01
 * Project: kfzphp.com
 * --------------------------------------------------------------
 */

class EntryController extends CrondController
{
    /**
     * 初始化
     */
    public function __construct()
    {
        parent::__construct();
        // 是否验证
        self::isVerify();

        ini_set('memory_limit', '512M');
        ini_set("max_execution_time", 0);
        set_time_limit(0);
    }

    /**
     * 是否通过验证
     * @return boolean    [description]
     */
    private function isVerify()
    {
        // 判断请求参数
        $get_token = $_GET['t'];
        if(!isset($get_token)) {
            exit('parameter error');
        }
        // 验证参数合法性
        $verify_token = $this->config['VERIFY_TOKEN'];
        if(!empty($verify_token) && ($verify_token != $get_token)) {
            exit('permission denied');
        }
    }

}